Skip to content

Mock time.sleep in unit tests #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2018
Merged

Conversation

laurenyu
Copy link
Contributor

Description of changes:
This change speeds up our unit tests.

Current test-run duration:
real 0m49.736s
user 0m6.219s
sys 0m1.089s

With this change:
real 0m9.447s
user 0m6.856s
sys 0m1.115s

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have updated the changelog with a description of my changes (if appropriate)
  • I have updated any necessary documentation (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@laurenyu laurenyu requested a review from iquintero July 19, 2018 18:01
@codecov-io
Copy link

codecov-io commented Jul 19, 2018

Codecov Report

Merging #307 into master will increase coverage by 0.17%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #307      +/-   ##
==========================================
+ Coverage   92.75%   92.92%   +0.17%     
==========================================
  Files          50       50              
  Lines        3463     3463              
==========================================
+ Hits         3212     3218       +6     
+ Misses        251      245       -6
Impacted Files Coverage Δ
src/sagemaker/tensorflow/estimator.py 93.33% <0%> (-2.97%) ⬇️
src/sagemaker/amazon/common.py 96.26% <0%> (+0.74%) ⬆️
src/sagemaker/utils.py 89.79% <0%> (+2.04%) ⬆️
src/sagemaker/local/image.py 89.44% <0%> (+2.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb4aa9d...867ce5b. Read the comment docs.

@laurenyu laurenyu merged commit 6ff1e23 into aws:master Jul 19, 2018
@laurenyu laurenyu deleted the speed-up-unit-tests branch July 19, 2018 20:50
@yangaws
Copy link
Contributor

yangaws commented Jul 24, 2018

Just a comment. If time.sleep is mocked, the test coverage for tensorboard will be dropped a lot since the mock test will be finished very soon before tensorboard process actually starts (initialization takes some time). But we may not need full coverage for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants